<?php	
	$submit = null;
	if( $_POST['email'] && $_POST['name'] && $_POST['content'] )	
	{	
		$submit = true;
		$txtName = $_POST['name'];
		$txtEmail = $_POST['email'];
		$txtMessage = $_POST['content'];
			
		$sto = $co_contact['email'];
		$thankscontact = $co_contact['thanks'];		

		$msg = "
			<b>".$yourname.": </b> ".$txtName." <br>	
			<b>".$youremail." : </b> ".$txtEmail." <br>	
			<b>".$message." : </b> ".$txtMessage." <br>	";
		
		//send email by function mail()		
		$subject =  "Contact from Bamix Website";
		$header = "From: ".$txtName."<".$txtEmail.">\n";
		$header .= "Content-Type: text/html;\n";
						
		$message_mail = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">
		<html>
		<head>
		<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">
		
		</head>
		<body>				
		".$msg."	
		
		</body>
		</html>";
		////////////////////
		mail($sto, $subject, $message_mail, $header);
		
			

		//fedback to customer
		$subject_1 = "Thank you for your message";
		$header_1 = "From: Bamix Website <".$sto.">\n";
		$header_1 .= "Content-Type: text/html;\n";
		$message_mail_1="<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">
		<html>
		<head>
		<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">
		
		</head>
		<body>
			".$thankscontact."<br><br>				
			
			".$msg."	
			
		</body>
		</html>";
		////////////////////			
		mail($txtEmail, $subject_1, $message_mail_1, $header_1);	
	}else{
		if ($_POST['submitContact']) {
			$submit = false;
		}		
	}
?>
<div class="w100100">
    <div class="title"><?=$co_contact['titlemenu'.$hg]?></div>
    <div class="contact-detail">
        <div class="content">
            <?=$co_contact['content'.$hg]?>
        </div>
		<div class="contact-form">
			<div class="message">
				<?php
				if ($submit === true) {
					echo $co_contact['description'.$hg];
				}
				if ($submit === false) {
					echo 'Please fill all content';
				}
				?>
			</div>
			<form action="<?php echo APPLICATION_URL; ?>contact.html" method="post" autocomplete="off">
				<table>
					<tr>
						<td class="right">
                                                    <div><label><?= $hg == "" ? "Name" : "Họ Tên" ?></label></div>
                                                    <input type="text" name="name">
						</td>
					</tr>
					<tr>
						<td class="right">
                                                    <div style="height:10px;"> </div>
                                                    <div><label><?= $hg == "" ? "Email" : "Email" ?> </label></div>
                                                    <input type="email" name="email">
						</td>
					</tr>
					
					
					
					<tr>
						
						<td class="right">
                                                    <div style="height:10px;"> </div>
                                                    <div><label><?= $hg == "" ? "Comments" : "Nội dung" ?> </label></div>
													<textarea name="content"></textarea>
						</td>
					</tr>
					<tr>
						
						<td class="right">
							<input type="submit" name="submitContact" class="contact-button" value="<?= $hg == "" ? " Send " : " Gửi " ?>">
						</td>
					</tr>
				</table>
			</form>			
		</div>
    </div>

</div>
